package com.tianyu.model.enums;

import lombok.Getter;

import java.util.Arrays;


/**********************************
 * @author swyan
 * @description 机场类型枚举
 * @date 2024/7/31 - 15:25
 **********************************/


@Getter
public enum DockTypeEnum {

    DOCK_1(1,"TY_CD", "充电机库"),
    DOCK_2(2,"TY_HD", "换电机库"),
    DOCK_3(3,"DJI", "大疆DOCK机库"),
    UNKNOWN(-1,"UNKNOWN", "未知类型");

    private final int code;
    private final String name;
    private final String desc;

    DockTypeEnum(int code, String name,String desc) {
        this.code = code;
        this.name = name;
        this.desc = desc;
    }

    public static DockTypeEnum findByCode(Integer code) {
        return Arrays.stream(DockTypeEnum.values())
                .filter(dockTypeEnum -> dockTypeEnum.getCode() == code).findFirst().orElse(UNKNOWN);
    }
}
